<!--
  Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.

  https://www.mall4j.com/

  未经允许，不可做商业用途！

  版权所有，侵权必究！
-->

<template>
  <!-- 《服务条款》与《隐私政策》 -->
  <div class="Mall4j terms-container page-terms-container">
    <div class="r-header">
      <div class="content">
        <router-link
          to="/"
          class="logo"
        >
          <img
            v-if="webConfigData.pcLogoImgText"
            class="logo-img"
            :src="webConfigData.pcLogoImgText"
            alt
          >
        </router-link>
        <div class="go-login">
          <router-link
            to="/login"
            class="login-btn"
          >
            {{ $t('register.goToLogin') }}
          </router-link>
        </div>
      </div>
    </div>
    <div class="terms-box">
      <div
        v-if="content"
        v-rich="content"
      />
    </div>
  </div>
</template>

<script setup>

const emit = defineEmits(['hideLoginPop'])

const route = useRoute()

const content = ref('')

const sts = ref(Number(route.query.sts))
onBeforeMount(() => {
  if (sts.value === 0) {
    http.get('/sys/config/info/serviceTerms').then(({ data }) => {
      content.value = JSON.parse(data).content
    })
  } else if (sts.value === 1) {
    http.get('/sys/config/info/servicePolicy').then(({ data }) => {
      content.value = JSON.parse(data).content
    })
  }
})
const webConfigStore = useWebConfigStore()
const webConfigData = computed(() => webConfigStore.pcConfig)
onMounted(() => {
  emit('hideLoginPop')
})

</script>

<style lang="scss" scoped>
@use "index";
</style>
